package com.example.mdm4

import androidx.appcompat.app.AppCompatActivity
import android.os.Bundle
import android.util.Log
import android.view.View
import io.virtualapp.hook_sdk.app.InstallAppUtils
//flow，
class VAppActivity : AppCompatActivity() {
    val appUtils by lazy { InstallAppUtils() }

    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        setContentView(R.layout.activity_vapp)
    }

    fun getAll(view: View) {
        val apps = appUtils.selInstalledApps()
        Log.i("===","已安装："+apps.toString())
    }
    fun installApp(view: View) {
        val installApp =
            appUtils.installApp("/storage/emulated/0/Android/data/com.example.mdm4/files/Download/webview.apk")
        Log.i("===","安装结果：$installApp")

    }
    fun open(view: View) {
        val apps = appUtils.selInstalledApps()
        appUtils.launchApp(apps[0].packageName)
    }
}